home *** CD-ROM | disk | FTP | other *** search
/ AMP Graphics Collection / AMP Graphics Collection.iso / programs / author / windirs / testd4.dir / 00002_Script_Cut -n- paste Lingo handlers < prev    next >
Text File  |  1996-07-26  |  3KB  |  119 lines

  1. --Cut and paste Lingo handlers
  2. --WinDirs XObject version 1.0, 7/26/96
  3. --Copyright ⌐ 1996 Glenn M. Picher, Dirigo Multimedia
  4. --Email: gpicher@maine.com
  5. --Web: http://www.maine.com/shops/gpicher
  6. --Phone: (207)767-8015 (South Portland, Maine, USA)
  7.  
  8. --Distribute freely. No licensing required.
  9.  
  10. --Also distributed by g/matter, inc.
  11. --Email: support@gmatter.com
  12. --Web: http://www.gmatter.com
  13. --Phone: (415)243-0394
  14.  
  15. -- End user handlers ----------------------------------------------
  16.  
  17. on getWindowsDirectory
  18.   global gWinDirsObject
  19.   insureWinDirs()
  20.   set theFolder = gWinDirsObject(mWindowsDirectory)
  21.   if word 1 of theFolder = "Error:" then
  22.     warning "getWindowsDirectory(): " & theFolder
  23.   end if
  24.   return theFolder
  25. end
  26.  
  27. on getSystemDirectory
  28.   global gWinDirsObject
  29.   insureWinDirs()
  30.   set theFolder = gWinDirsObject(mSystemDirectory)
  31.   if word 1 of theFolder = "Error:" then
  32.     warning "getSystemDirectory(): " & theFolder
  33.   end if
  34.   return theFolder
  35. end
  36.  
  37. on showWarnings
  38.   global gShowWarnings
  39.   set gShowWarnings to TRUE
  40. end
  41.  
  42. on hideWarnings
  43.   global gShowWarnings
  44.   set gShowWarnings to FALSE
  45. end
  46.  
  47. -- Support handlers ----------------------------------------------
  48.  
  49. --These handlers are called from the handlers above.
  50. --You needn't call them directly (although you might wish to
  51. --include openWinDirs() in your startMovie() handler, and
  52. --closeWinDirs() in your stopMovie() handler or final 'quit'
  53. --button.
  54.  
  55. --Change the pathname or filename in the openWinDirs() handler
  56. --if the XObject is not located in the same place as the
  57. --Director movie or projector. Change closeWinDirs()
  58. --similarly. 
  59.  
  60. on openWinDirs
  61.   if xobjectLoaded("WinDirs") then return TRUE
  62.   if the machineType >= 256 then
  63.     openxlib "WINDIRS.DLL"
  64.   else
  65.     warning "WinDirs is designed only for Windows!"
  66.     return FALSE
  67.   end if
  68.   if not xobjectLoaded("WinDirs") then
  69.     warning "WinDirs XObject didn't register."
  70.     return FALSE
  71.   end if
  72.   return TRUE
  73. end
  74.  
  75. on closeWinDirs
  76.   global gWinDirsObject
  77.   if objectP(gWinDirsObject) then gWinDirsObject(mDispose)
  78.   if not xobjectLoaded("WinDirs") then return TRUE
  79.   if the machineType >= 256 then
  80.     closexlib "WINDIRS.DLL"
  81.   else
  82.     warning "WinDirs is designed only for Windows!"
  83.     return FALSE
  84.   end if
  85.   if xobjectLoaded("WinDirs") then
  86.     warning "WinDirs XObject wouldn't close-- do objects still exist?"
  87.     return FALSE
  88.   end if
  89.   return TRUE
  90. end
  91.  
  92. on insureWinDirs
  93.   global gWinDirsObject
  94.   if objectP(gWinDirsObject) then return TRUE
  95.   if not openWinDirs() then
  96.     warning "insureWinDirs(): openWinDirs() failed"
  97.     abort
  98.   end if
  99.   put WinDirs(mNew) into gWinDirsObject
  100.   if not objectP(gWinDirsObject) then
  101.     warning "insureWinDirs(): couldn't create object"
  102.     abort
  103.   end if
  104.   return true
  105. end
  106.  
  107. on xobjectLoaded theName
  108.   if not stringP(theName) then 
  109.     warning "xobjectLoaded(): theName not a string"
  110.     return false
  111.   end if
  112.   return objectP(factory(theName))
  113. end
  114.  
  115. on warning theMessage
  116.   global gShowWarnings
  117.   if not (gShowWarnings = TRUE) then return
  118.   alert theMessage
  119. end